package cate.game.role.base;

import cate.common.table.d.GDOperation;
import cate.common.table.role.vip.VipCsMailRow;
import cate.game.mail.po.MailBuilder;
import cate.game.role.Role;
import cate.game.role.mail.Mail;

public class VipCsMailHandler {

    public static void exe(Role role, int newVip) {
        for(int lv = role.getBase().uni.vipCsMailGotLv; lv <= newVip; lv++) {
            VipCsMailRow row = role.getGame().table.vip.csMail.find(lv, role.getBase().gameId);
            if(row != null) {
                Mail mail = new MailBuilder().setReward(null)
                        .setTitle(row.mailTitle)
                        .setContent(row.mailContent)
                        .setOperation(GDOperation.NULL).build();
                role.getMail().add(mail);
            }
            role.getBase().uni.vipCsMailGotLv = lv;
        }

    }
}
